//
//  OAMessageDetailViewController.m
//  OASystem
//
//  Created by zhoupengfei on 16/2/28.
//  Copyright © 2016年 zpf. All rights reserved.
//

#import "OAMessageDetailViewController.h"

@interface OAMessageDetailViewController ()
//@property (weak, nonatomic) IBOutlet UILabel *nameLabel;
//@property (weak, nonatomic) IBOutlet UILabel *phoneLabel;
//@property (weak, nonatomic) IBOutlet UILabel *sendTime;
//@property (weak, nonatomic) IBOutlet UITextView *textview;

@end

@implementation OAMessageDetailViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
//       self.tableView.separatorStyle = UITableViewCellSelectionStyleNone;

//    self.nameLabel.text = self.model.acceptphoneuser;
//    self.phoneLabel.text = self.model.phone;
//    self.sendTime.text = self.model.sendtime;
//    self.textview.text = self.model.subject;
//  self.textlabel.numberOfLines = 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return  4;
}
#pragma mark UITableView dataScource
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
if (indexPath.row ==0) {
    
     UITableViewCell* cell = [[UITableViewCell alloc]init];
      UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(10, 0, 80, cell.contentView.height)];
    label.text = @"姓名:";
     label.font = [UIFont systemFontOfSize:16];
    [cell.contentView addSubview:label];
  UILabel *label2= [[UILabel alloc]initWithFrame:CGRectMake(label.right, label.top, KScreenWidth  -100, label.height)];
    label2.text = self.model.acceptphoneuser;
//    label2.textAlignment = NSTextAlignmentRight;
     label2.font = [UIFont systemFontOfSize:16];
    [cell.contentView addSubview:label2];
    return cell;

}
    if (indexPath.row ==1) {
    
     UITableViewCell* cell = [[UITableViewCell alloc]init];
      UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(10, 0, 100, cell.contentView.height)];
    label.text = @"电话号码:";
     label.font = [UIFont systemFontOfSize:16];
    [cell.contentView addSubview:label];
  UILabel *label2= [[UILabel alloc]initWithFrame:CGRectMake(label.right, label.top,KScreenWidth -120, label.height)];
//      label2.textAlignment = NSTextAlignmentRight;

    label2.text = self.model.phone;
     label2.font = [UIFont systemFontOfSize:16];
    [cell.contentView addSubview:label2];
    return cell;

}
if (indexPath.row ==2) {
    
     UITableViewCell* cell = [[UITableViewCell alloc]init];
      UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(10, 0, 100, cell.contentView.height)];
    label.text = @"发送时间:";
     label.font = [UIFont systemFontOfSize:16];
    [cell.contentView addSubview:label];
  UILabel *label2= [[UILabel alloc]initWithFrame:CGRectMake(label.right, label.top, KScreenWidth  -120, label.height)];
    label2.text = [NSString stringWithFormat:@"%@",self.model.sendtime];
//      label2.textAlignment = NSTextAlignmentRight;

     label2.font = [UIFont systemFontOfSize:16];
    [cell.contentView addSubview:label2];
    return cell;

}
else {
    
     UITableViewCell* cell = [[UITableViewCell alloc]init];
      UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(10, 0, 100, cell.contentView.height)];
    label.text = @"发送内容:";
     label.font = [UIFont systemFontOfSize:16];
          CGFloat titleSize = [OAToolBox sizebyText:self.model.subject font:16 minsWidth:120];

    [cell.contentView addSubview:label];
     if (titleSize<44) {
    titleSize =  cell.height;
}else{
titleSize = titleSize;

}

  UILabel *label2= [[UILabel alloc]initWithFrame:CGRectMake(label.right, label.top,KScreenWidth  -120, titleSize)];
    label2.text = self.model.subject;
//          label2.textAlignment = NSTextAlignmentRight;
label2.numberOfLines = 0;
     label2.font = [UIFont systemFontOfSize:16];
    [cell.contentView addSubview:label2];
    return cell;

}
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
CGFloat H = 44;
if (indexPath.row == 3){
 CGFloat titleSize = [OAToolBox sizebyText:self.model.subject font:16 minsWidth:120];
if (titleSize<44) {
    return 44;
}else{
return titleSize;

}
}

else{

return H;
}

}


@end
